<style>
    body {
        background-color: #FAFBFB;
    }

    .zything div {
        margin-top: 10px;
    }
</style>
<div class="rc-pagepadding ">
    <div class=" rc-pannel rc-pagepadding">

        <div class="rc-pannel-body layui-form ">
            <form class="layui-form" action="">
                <?php
                foreach ($config['form'] as $key => $form) {
                ?>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><?php echo $form ?></label>
                        <div class="layui-input-block">
                            <input type="text" name="<?php echo $key ?>" value="<?php echo $config['value'][$key]?>" placeholder="请输入" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                <?php
                }
                ?>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="button" class="layui-btn layui-btn-primary" lay-submit lay-filter="submit">配置</button>
                        <button type="reset" class="layui-btn ">重置</button>
                    </div>
                </div>
            </form>

        </div>


    </div>


</div>
<script>
    layui.use(function() {
        var form = layui.form;
        form.on('submit(submit)', function(data) {
            $.ajax({
                url: '/admin/cnf/Plugin/setConfig?id=<?php echo request()->get('id') ?>', //请求路径
                type: "POST", //请求方式
                data: data.field, // 默认写法
                success: function(data) {
                    if (data.code == 0) {
                        toastr_success('配置成功', function() {
                            window.parent.location.reload();
                        });
                    } else {
                        toastr_error(data.message);
                    }
                },
                error: function() {

                },

            });
        });
    });
</script>